package com.andy.buyu.server.entity;

import java.util.Map;

public class ConfScript extends BaseEntity{

	private static final long serialVersionUID = 1L;

	public ConfScript() {
	}
	
	public ConfScript(Long id) {
		super(id);
	}
	
	private Integer scriptId;
	
	private Integer nextId;
	
	private Integer fishId;
	
	private Integer showTime;
	
	private Integer outTime;
	
	private String trai;
	
	private Integer direc;// 初始朝向

	public static String table() {
		return "conf_script";
	}

	public Integer getScriptId() {
		return scriptId;
	}

	public void setScriptId(Integer scriptId) {
		this.scriptId = scriptId;
	}

	public Integer getNextId() {
		return nextId;
	}

	public void setNextId(Integer nextId) {
		this.nextId = nextId;
	}

	public Integer getFishId() {
		return fishId;
	}

	public void setFishId(Integer fishId) {
		this.fishId = fishId;
	}

	public Integer getShowTime() {
		return showTime;
	}

	public void setShowTime(Integer showTime) {
		this.showTime = showTime;
	}

	public Integer getOutTime() {
		return outTime;
	}

	public void setOutTime(Integer outTime) {
		this.outTime = outTime;
	}

	public String getTrai() {
		return trai;
	}

	public void setTrai(String trai) {
		this.trai = trai;
	}

	public int duration() {
		return outTime - showTime;
	}

	public Integer getDirec() {
		return direc;
	}

	public void setDirec(Integer direc) {
		this.direc = direc;
	}

	public void init(Map<Integer, ConfScriptTrai> scriptTrais) {
		if(this.trai.length() < 10) {
			ConfScriptTrai scriptTrai = scriptTrais.get(Integer.valueOf(trai));
			if(scriptTrai != null) {
				outTime = showTime+scriptTrai.getPlayTime();
			}
		}
	}

	
}
